package yang.VirtualMachine.chapter9.classStruct.constantPool;

import java.io.IOException;
import java.io.InputStream;

import yang.VirtualMachine.chapter9.ClassUtil;
import yang.VirtualMachine.chapter9.Processer;

/**
 * u1 tag;u2 length;			u1 bytes[length]
 * @author xinxin
 */
public class Con_Utf8Processer implements Processer, PoolValue {
	
	public static int tag = ConstantPoolController.CONSTANT_Utf8;
	
	private int length;
	
	private String value;
	
	@Override
	public void process(InputStream input) throws IOException {
		length = (int) ClassUtil.getNumByStream(input, 2);
		value = ClassUtil.getStrByStream(input, length);
		System.out.printf("长度：%d 内容： %s\n", length, value);
	}

	@Override
	public String getValue() {
		return value;
	}

}
